package com.jn.erp.wechat.student.api.controller;

import com.alibaba.fastjson2.JSONObject;
import com.jn.erp.common.core.result.AjaxResult;
import com.jn.erp.wechat.common.api.controller.base.BaseWxAuthController;
import com.jn.erp.wechat.common.api.entity.dto.WxMpDto;
import com.jn.erp.wechat.student.handler.StudentMpInfoHandler;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <pre>
 *  小程序交互信息
 * </pre>
 *
 * @author sunjiyong
 * @since 2024/9/10 9:50
 */
@AllArgsConstructor
@RestController
@RequestMapping("/wxs/maportal")
public class StudentMpController extends BaseWxAuthController {

    @Autowired
    private StudentMpInfoHandler studentMpInfoHandler;


    @PostMapping("/getPhoneNumber")
    public AjaxResult getPhoneNumber(@RequestBody WxMpDto wxMpDto) {
        JSONObject phoneNumberInfo = studentMpInfoHandler.getPhoneNumber(wxMpDto.getCode());
        if(phoneNumberInfo==null){
            return error("获取用户手机信息失败");
        }
        return success(phoneNumberInfo);
    }

}
